home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Resources
/
PaperCut Quota 6.1
/
pc-setup.exe
/
{app}
/
delete-virtual-dir.vbs
< prev
next >
Wrap
Text File
|
2005-10-17
|
918b
|
39 lines
Option Explicit
'On Error Resume Next
Dim oArgs
Set oArgs = WScript.Arguments
If oArgs.Count <> 1 Then
ErrorExit "Require the 'virtual-dir-name' parameter"
End If
Dim sComputer, sVirtualDir, oVDir
sComputer = "localhost"
sVirtualDir = oArgs(0)
DebugLog "Check if virtual dir exists"
Set oVDir = GetObject("IIS://" & sComputer & "/W3SVC/1/Root/" & sVirtualDir)
If Err.Number = 0 Then
' Virtual dir exists, so delete.
Dim oRoot, oSite
Set oSite = GetObject("IIS://" & sComputer & "/W3SVC/1")
Set oRoot = oSite.GetObject( "IIsWebVirtualDir", "Root")
DebugLog "Delete virtual dir"
oRoot.Delete "IIsWebVirtualDir", sVirtualDir
End If
Sub DebugLog(sMsg)
'WScript.Echo sMsg
End Sub
' Displays a message to the user then exits with error code.
Sub ErrorExit(sMsg)
On Error Resume Next
WScript.Echo sMsg
WScript.Quit 1
End Sub